Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 6, 2026

Python and Go SDKs lacked the CLI arguments pass-through option available in Node.js and .NET, preventing users from passing custom flags to the underlying Copilot CLI process.

Changes

Python SDK (cli_args: list[str])

  • Added field to CopilotClientOptions TypedDict
  • Arguments prepended before SDK-managed flags in _start_cli_server
  • Defensive copy via list() to prevent mutations

Go SDK (CLIArgs []string)

  • Added field to ClientOptions struct
  • Arguments prepended before SDK-managed flags in startCLIServer
  • Defensive copy via append([]string{}, ...) pattern

Documentation

  • Updated READMEs for both SDKs

Usage

# Python
client = CopilotClient({
    "cli_args": ["--custom-flag", "--debug-mode"],
    "log_level": "info"
})
// Go
client := copilot.NewClient(&copilot.ClientOptions{
    CLIArgs: []string{"--custom-flag", "--debug-mode"},
    LogLevel: "info",
})

User-provided arguments are inserted before SDK-managed flags like --headless and --no-auto-update, allowing CLI customization while preserving SDK functionality.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/copilot_internal/user
    • Triggering command: /opt/hostedtoolcache/node/22.22.0/x64/bin/node node /home/REDACTED/work/copilot-sdk/copilot-sdk/nodejs/node_modules/@github/copilot/index.js --headless --no-auto-update --log-level info --stdio (http block)
    • Triggering command: /opt/hostedtoolcache/node/22.22.0/x64/bin/node node /home/REDACTED/work/copilot-sdk/copilot-sdk/nodejs/node_modules/@github/copilot/index.js --headless --no-auto-update --log-level info --stdio /usr/local/.ghcu--64 (http block)
    • Triggering command: /opt/hostedtoolcache/node/22.22.0/x64/bin/node node /home/REDACTED/work/copilot-sdk/copilot-sdk/nodejs/node_modules/@github/copilot/index.js --headless --no-auto-update --log-level info --stdio x64/pkg/tool/lin--64 (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Cant pass CLI arguments in python module, despite possible in Node.js module</issue_title>
<issue_description>CopilotClientOptions.cliArgs field in nodejs module is not available in the py module equivalent object. An SDK inconsistency.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 6, 2026 19:10
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
Co-authored-by: friggeri <106686+friggeri@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CLI arguments handling in Python module Add cli_args/CLIArgs to Python and Go SDKs for cross-SDK consistency Feb 6, 2026
Copilot AI requested a review from friggeri February 6, 2026 19:17
@friggeri friggeri marked this pull request as ready for review February 10, 2026 17:48
@friggeri friggeri requested a review from a team as a code owner February 10, 2026 17:48
Copilot AI review requested due to automatic review settings February 10, 2026 17:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a cross-SDK “pass extra Copilot CLI flags” option to the Python and Go SDKs, aligning them with existing Node.js and .NET capabilities when spawning the Copilot CLI JSON-RPC server.

Changes:

  • Python: introduce cli_args: list[str] in CopilotClientOptions, defensively copied and prepended to SDK-managed CLI flags when starting the CLI process.
  • Go: introduce CLIArgs []string in ClientOptions, defensively copied and prepended to SDK-managed CLI flags when starting the CLI process.
  • Docs + unit tests added/updated for both SDKs.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
python/copilot/types.py Adds cli_args option to Python client options type.
python/copilot/client.py Copies cli_args into stored options and prepends them when spawning the CLI server.
python/test_client.py Adds unit tests validating default, acceptance, and defensive copying of cli_args.
python/README.md Documents cli_args option.
go/types.go Adds CLIArgs to Go ClientOptions.
go/client.go Defensively copies CLIArgs into options and prepends them when spawning the CLI server.
go/client_test.go Adds unit tests for default behavior, acceptance, empty slice handling, and defensive copying.
go/README.md Documents CLIArgs option.

@github-actions
Copy link

✅ Cross-SDK Consistency Review

I've reviewed this PR for cross-language SDK consistency. Overall, this is an excellent consistency improvement that successfully brings Python and Go SDKs to feature parity with Node.js and .NET.

✅ What's Great

  1. Perfect API naming: Each SDK follows its language conventions correctly:

    • Node.js: cliArgs (camelCase)
    • Python: cli_args (snake_case)
    • Go: CLIArgs (PascalCase)
    • .NET: CliArgs (PascalCase)
  2. Consistent behavior: All SDKs prepend user args before SDK-managed flags in the same way

  3. Defensive copying: Both Python and Go properly create defensive copies to prevent external mutations (matching the repository's defensive copying pattern)

  4. Good documentation: READMEs updated with consistent descriptions

  5. Excellent test coverage: Python (3 tests) and Go (4 tests) both have comprehensive unit tests including edge cases

📊 Minor Observation: Test Coverage Disparity

This PR actually improves the overall consistency of the repository by adding unit tests for the new implementations. However, there's now a slight testing inconsistency:

  • ✅ Python SDK: Has unit tests for cli_args
  • ✅ Go SDK: Has unit tests for CLIArgs
  • ⚠️ Node.js SDK: No unit tests for cliArgs (existed before this PR)
  • ⚠️ .NET SDK: No unit tests for CliArgs (existed before this PR)

This is not a blocker for this PR since you're not responsible for the Node.js/.NET implementations, but it's worth noting for future work that Node.js and .NET could benefit from similar unit test coverage.

✅ Recommendation

Approve and merge. This PR successfully resolves the SDK inconsistency reported in issue #381 and follows all cross-language consistency best practices.

AI generated by SDK Consistency Review Agent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cant pass CLI arguments in python module, despite possible in Node.js module

2 participants